//
//  UIView+Extension.h
//  SouWeiLaiSwift
//
//  Created by yxl on 2022/4/11.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIView (Extension)

@property (nonatomic, assign) CGFloat x;
@property (nonatomic, assign) CGFloat y;
@property (nonatomic, assign) CGFloat width;
@property (nonatomic, assign) CGFloat height;
@property (nonatomic, assign) CGFloat centerX;
@property (nonatomic, assign) CGFloat centerY;
@property (nonatomic, assign) CGSize  size;
@property (nonatomic, assign) CGPoint origin;

@property (nonatomic, assign) CGFloat left;
@property (nonatomic, assign) CGFloat top;
@property (nonatomic, assign) CGFloat right;
@property (nonatomic, assign) CGFloat bottom;

+ (instancetype)viewFromXib;

- (BOOL)intersectWithView:(UIView *)view;

/// 获取当前View所在的viewcontroler
- (UIViewController *)getCurrentViewController;

/// 添加子View（array：添加子的ViewArray）
- (void)addSubViewsWithArray:(NSArray *)array;

/// 移除所有 subviews
- (void)removeAllSubviews;

/// 找到指定类名的subView
- (UIView *)findSubViewWithClass:(Class)clazz;

/// 找到指定类名的所有subView
- (NSArray *)findAllSubViewsWithClass:(Class)clazz;

/// 找到指定类名的superView对象
- (UIView *)findSuperViewWithClass:(Class)clazz;

/// 找到view上的第一响应者
- (UIView *)findFirstResponder;

/// 给UIView添加点击事件
- (void)addTarget:(id)target
              action:(SEL)action;
@end

NS_ASSUME_NONNULL_END
